**************************************************************************************************************
**	Replication do-file for "Social Democracy and the Birth of Working-Class Representation in Europe"
**  Purpose: Replicate Table 3 (England and Wales) & produce Figure 7b
*************************************************************************************************************

/* set the directory */

/************************
     TABLE 3 Pre-war 
*************************/
use "Britain prewar.dta", clear

**		Keep the pre-war years
keep if parl_year> 1884 & parl_year <1918

zip mp_manual skill_manual_men                         by_election total_seats, inflate(labour) 
estat ic

zip mp_manual c.skill_manual_men##c.skill_manual_men   by_election total_seats, inflate(labour) 
estat ic

/**************************
     TABLE 3 Interwar 
***************************/
use "Britain interwar.dta", clear

**	create a dummy for the 1918 elections
gen y1918=(year==1918)

zip mp_manual housing_1half_and_above y1918                             , inflate(labour)   
estat ic

zip mp_manual c.housing_1half_and_above##c.housing_1half_and_above y1918, inflate(labour) 
estat ic	

/************************
    Produce Figure 7b 
*************************/
replace housing_1half_and_above=housing_1half_and_above*100
label var housing_1half_and_above "Percent Population in Dense Housing"
zip mp_manual c.housing_1half_and_above##c.housing_1half_and_above y1918, inflate(labour) 
margins, at(housing_1half_and_above=(10 20 30 40 45 50 60 70))
marginsplot, title("") ///
	 		 ytitle("Predicted Probability of Working-Class MP") legend(off) ///
			 addplot(hist housing_1half_and_above, yaxis(2)  ysc(axis(2) alt) fcolor(gs6%20) lcolor(gs6%20)) ///
			 graphregion(fcolor(white) ilcolor(white) lcolor(white)) 

		    